import { uiProperties, uiStyleProperties, enumProperties } from './common'

// select
export const selectProperties = [
    ...uiProperties.filter(e => ['ui.placeholder', 'ui.clearable'].indexOf(e.model) !== -1),
    ...uiStyleProperties.filter(e => ['ui.style.width'].indexOf(e.model) !== -1),
    ...enumProperties.filter(e => ['enum'].indexOf(e.model) !== -1),
    {
        model: 'ui.multiple',
        widget: 'switch',
        label: '多选'
    },
    {
        model: 'ui.collapseTags',
        widget: 'switch',
        label: '多选文字展开',
        if (model) {
            return model && model.ui && model.ui.multiple
        }
    },
    {
        model: 'ui.multipleLimit',
        widget: 'inputNumber',
        label: '最多可选择个数',
        ui: {
            placeholder: '为0时不限制',
            min: 0,
            max: 99999999,
            precision: 0,
            controlsPosition: 'right',
            style: {
                width: '100%'
            }
        },
        if (model) {
            return model && model.ui && model.ui.multiple
        }
    },
    {
        model: 'ui.filterable',
        widget: 'switch',
        label: '可搜索'
    },
    {
        model: 'ui.allowCreate',
        widget: 'switch',
        label: '允许用户创建条目',
        if (model) {
            return model && model.ui && model.ui.filterable
        }
    }
]
